import React, { FC, createElement } from 'react';
import { SetterHoc } from '../../common';
import { Switch } from 'antd';

export interface ISelectTypeSetterProps {
  value: any;
  disabled: boolean;
  defaultValue: any;
  onChange: (val: any) => void;
}

const SelectTypeSetterFun: FC<ISelectTypeSetterProps> = (props) => {
  const { onChange, value } = props;
  return (
    <Switch
      className="switch-style"
      checked={value === 'multiple'}
      // size="small"
      onChange={(val: any) => onChange(!val ? 'single' : 'multiple')}
    />
  );
};

export const SelectTypeSetter = SetterHoc(SelectTypeSetterFun);
